google_firebaseml1/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 data and see the email address for your Google Account.
17 CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::CloudPlatform
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all FirebaseML 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_firebaseml1 as firebaseml1;
49/// use firebaseml1::{Result, Error};
50/// # async fn dox() {
51/// use firebaseml1::{FirebaseML, 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 = FirebaseML::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.operations().list("name")
93/// .return_partial_success(true)
94/// .page_token("gubergren")
95/// .page_size(-75)
96/// .filter("dolor")
97/// .doit().await;
98///
99/// match result {
100/// Err(e) => match e {
101/// // The Error enum provides details about what exactly happened.
102/// // You can also just use its `Debug`, `Display` or `Error` traits
103/// Error::HttpError(_)
104/// |Error::Io(_)
105/// |Error::MissingAPIKey
106/// |Error::MissingToken(_)
107/// |Error::Cancelled
108/// |Error::UploadSizeLimitExceeded(_, _)
109/// |Error::Failure(_)
110/// |Error::BadRequest(_)
111/// |Error::FieldClash(_)
112/// |Error::JsonDecodeError(_, _) => println!("{}", e),
113/// },
114/// Ok(res) => println!("Success: {:?}", res),
115/// }
116/// # }
117/// ```
118#[derive(Clone)]
119pub struct FirebaseML<C> {
120 pub client: common::Client<C>,
121 pub auth: Box<dyn common::GetToken>,
122 _user_agent: String,
123 _base_url: String,
124 _root_url: String,
125}
126
127impl<C> common::Hub for FirebaseML<C> {}
128
129impl<'a, C> FirebaseML<C> {
130 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> FirebaseML<C> {
131 FirebaseML {
132 client,
133 auth: Box::new(auth),
134 _user_agent: "google-api-rust-client/7.0.0".to_string(),
135 _base_url: "https://firebaseml.googleapis.com/".to_string(),
136 _root_url: "https://firebaseml.googleapis.com/".to_string(),
137 }
138 }
139
140 pub fn operations(&'a self) -> OperationMethods<'a, C> {
141 OperationMethods { hub: self }
142 }
143
144 /// Set the user-agent header field to use in all requests to the server.
145 /// It defaults to `google-api-rust-client/7.0.0`.
146 ///
147 /// Returns the previously set user-agent.
148 pub fn user_agent(&mut self, agent_name: String) -> String {
149 std::mem::replace(&mut self._user_agent, agent_name)
150 }
151
152 /// Set the base url to use in all requests to the server.
153 /// It defaults to `https://firebaseml.googleapis.com/`.
154 ///
155 /// Returns the previously set base url.
156 pub fn base_url(&mut self, new_base_url: String) -> String {
157 std::mem::replace(&mut self._base_url, new_base_url)
158 }
159
160 /// Set the root url to use in all requests to the server.
161 /// It defaults to `https://firebaseml.googleapis.com/`.
162 ///
163 /// Returns the previously set root url.
164 pub fn root_url(&mut self, new_root_url: String) -> String {
165 std::mem::replace(&mut self._root_url, new_root_url)
166 }
167}
168
169// ############
170// SCHEMAS ###
171// ##########
172/// The request message for Operations.CancelOperation.
173///
174/// # Activities
175///
176/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
177/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
178///
179/// * [cancel operations](OperationCancelCall) (request)
180#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
181#[serde_with::serde_as]
182#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
183pub struct CancelOperationRequest {
184 _never_set: Option<bool>,
185}
186
187impl common::RequestValue for CancelOperationRequest {}
188
189/// 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); }
190///
191/// # Activities
192///
193/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
194/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
195///
196/// * [cancel operations](OperationCancelCall) (response)
197/// * [delete operations](OperationDeleteCall) (response)
198#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
199#[serde_with::serde_as]
200#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
201pub struct Empty {
202 _never_set: Option<bool>,
203}
204
205impl common::ResponseResult for Empty {}
206
207/// The response message for Operations.ListOperations.
208///
209/// # Activities
210///
211/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
212/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
213///
214/// * [list operations](OperationListCall) (response)
215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
216#[serde_with::serde_as]
217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
218pub struct ListOperationsResponse {
219 /// The standard List next-page token.
220 #[serde(rename = "nextPageToken")]
221 pub next_page_token: Option<String>,
222 /// A list of operations that matches the specified filter in the request.
223 pub operations: Option<Vec<Operation>>,
224 /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
225 pub unreachable: Option<Vec<String>>,
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/// * [delete operations](OperationDeleteCall) (none)
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 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
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. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
251 pub name: Option<String>,
252 /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
253 pub response: Option<HashMap<String, serde_json::Value>>,
254}
255
256impl common::Resource for Operation {}
257
258/// 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).
259///
260/// This type is not used in any activity, and only used as *part* of another schema.
261///
262#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
263#[serde_with::serde_as]
264#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
265pub struct Status {
266 /// The status code, which should be an enum value of google.rpc.Code.
267 pub code: Option<i32>,
268 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
269 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
270 /// 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.
271 pub message: Option<String>,
272}
273
274impl common::Part for Status {}
275
276// ###################
277// MethodBuilders ###
278// #################
279
280/// A builder providing access to all methods supported on *operation* resources.
281/// It is not used directly, but through the [`FirebaseML`] hub.
282///
283/// # Example
284///
285/// Instantiate a resource builder
286///
287/// ```test_harness,no_run
288/// extern crate hyper;
289/// extern crate hyper_rustls;
290/// extern crate google_firebaseml1 as firebaseml1;
291///
292/// # async fn dox() {
293/// use firebaseml1::{FirebaseML, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
294///
295/// let secret: yup_oauth2::ApplicationSecret = Default::default();
296/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
297/// .with_native_roots()
298/// .unwrap()
299/// .https_only()
300/// .enable_http2()
301/// .build();
302///
303/// let executor = hyper_util::rt::TokioExecutor::new();
304/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
305/// secret,
306/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
307/// yup_oauth2::client::CustomHyperClientBuilder::from(
308/// hyper_util::client::legacy::Client::builder(executor).build(connector),
309/// ),
310/// ).build().await.unwrap();
311///
312/// let client = hyper_util::client::legacy::Client::builder(
313/// hyper_util::rt::TokioExecutor::new()
314/// )
315/// .build(
316/// hyper_rustls::HttpsConnectorBuilder::new()
317/// .with_native_roots()
318/// .unwrap()
319/// .https_or_http()
320/// .enable_http2()
321/// .build()
322/// );
323/// let mut hub = FirebaseML::new(client, auth);
324/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
325/// // like `cancel(...)`, `delete(...)` and `list(...)`
326/// // to build up your call.
327/// let rb = hub.operations();
328/// # }
329/// ```
330pub struct OperationMethods<'a, C>
331where
332 C: 'a,
333{
334 hub: &'a FirebaseML<C>,
335}
336
337impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
338
339impl<'a, C> OperationMethods<'a, C> {
340 /// Create a builder to help you perform the following task:
341 ///
342 /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
343 ///
344 /// # Arguments
345 ///
346 /// * `request` - No description provided.
347 /// * `name` - The name of the operation resource to be cancelled.
348 pub fn cancel(
349 &self,
350 request: CancelOperationRequest,
351 name: &str,
352 ) -> OperationCancelCall<'a, C> {
353 OperationCancelCall {
354 hub: self.hub,
355 _request: request,
356 _name: name.to_string(),
357 _delegate: Default::default(),
358 _additional_params: Default::default(),
359 _scopes: Default::default(),
360 }
361 }
362
363 /// Create a builder to help you perform the following task:
364 ///
365 /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
366 ///
367 /// # Arguments
368 ///
369 /// * `name` - The name of the operation resource to be deleted.
370 pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, C> {
371 OperationDeleteCall {
372 hub: self.hub,
373 _name: name.to_string(),
374 _delegate: Default::default(),
375 _additional_params: Default::default(),
376 _scopes: Default::default(),
377 }
378 }
379
380 /// Create a builder to help you perform the following task:
381 ///
382 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
383 ///
384 /// # Arguments
385 ///
386 /// * `name` - The name of the operation's parent resource.
387 pub fn list(&self, name: &str) -> OperationListCall<'a, C> {
388 OperationListCall {
389 hub: self.hub,
390 _name: name.to_string(),
391 _return_partial_success: Default::default(),
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. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
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_firebaseml1 as firebaseml1;
419/// use firebaseml1::api::CancelOperationRequest;
420/// # async fn dox() {
421/// # use firebaseml1::{FirebaseML, 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 = FirebaseML::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 FirebaseML<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: "firebaseml.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/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
741///
742/// A builder for the *delete* 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_firebaseml1 as firebaseml1;
753/// # async fn dox() {
754/// # use firebaseml1::{FirebaseML, 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 = FirebaseML::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().delete("name")
789/// .doit().await;
790/// # }
791/// ```
792pub struct OperationDeleteCall<'a, C>
793where
794 C: 'a,
795{
796 hub: &'a FirebaseML<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 OperationDeleteCall<'a, C> {}
804
805impl<'a, C> OperationDeleteCall<'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, Empty)> {
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: "firebaseml.operations.delete",
821 http_method: hyper::Method::DELETE,
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::DELETE)
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 to be deleted.
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) -> OperationDeleteCall<'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(
961 mut self,
962 new_value: &'a mut dyn common::Delegate,
963 ) -> OperationDeleteCall<'a, C> {
964 self._delegate = Some(new_value);
965 self
966 }
967
968 /// Set any additional parameter of the query string used in the request.
969 /// It should be used to set parameters which are not yet available through their own
970 /// setters.
971 ///
972 /// Please note that this method must not be used to set any of the known parameters
973 /// which have their own setter method. If done anyway, the request will fail.
974 ///
975 /// # Additional Parameters
976 ///
977 /// * *$.xgafv* (query-string) - V1 error format.
978 /// * *access_token* (query-string) - OAuth access token.
979 /// * *alt* (query-string) - Data format for response.
980 /// * *callback* (query-string) - JSONP
981 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
982 /// * *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.
983 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
984 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
985 /// * *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.
986 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
987 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
988 pub fn param<T>(mut self, name: T, value: T) -> OperationDeleteCall<'a, C>
989 where
990 T: AsRef<str>,
991 {
992 self._additional_params
993 .insert(name.as_ref().to_string(), value.as_ref().to_string());
994 self
995 }
996
997 /// Identifies the authorization scope for the method you are building.
998 ///
999 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1000 /// [`Scope::CloudPlatform`].
1001 ///
1002 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1003 /// tokens for more than one scope.
1004 ///
1005 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1006 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1007 /// sufficient, a read-write scope will do as well.
1008 pub fn add_scope<St>(mut self, scope: St) -> OperationDeleteCall<'a, C>
1009 where
1010 St: AsRef<str>,
1011 {
1012 self._scopes.insert(String::from(scope.as_ref()));
1013 self
1014 }
1015 /// Identifies the authorization scope(s) for the method you are building.
1016 ///
1017 /// See [`Self::add_scope()`] for details.
1018 pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationDeleteCall<'a, C>
1019 where
1020 I: IntoIterator<Item = St>,
1021 St: AsRef<str>,
1022 {
1023 self._scopes
1024 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1025 self
1026 }
1027
1028 /// Removes all scopes, and no default scope will be used either.
1029 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1030 /// for details).
1031 pub fn clear_scopes(mut self) -> OperationDeleteCall<'a, C> {
1032 self._scopes.clear();
1033 self
1034 }
1035}
1036
1037/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1038///
1039/// A builder for the *list* method supported by a *operation* resource.
1040/// It is not used directly, but through a [`OperationMethods`] instance.
1041///
1042/// # Example
1043///
1044/// Instantiate a resource method builder
1045///
1046/// ```test_harness,no_run
1047/// # extern crate hyper;
1048/// # extern crate hyper_rustls;
1049/// # extern crate google_firebaseml1 as firebaseml1;
1050/// # async fn dox() {
1051/// # use firebaseml1::{FirebaseML, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1052///
1053/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1054/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1055/// # .with_native_roots()
1056/// # .unwrap()
1057/// # .https_only()
1058/// # .enable_http2()
1059/// # .build();
1060///
1061/// # let executor = hyper_util::rt::TokioExecutor::new();
1062/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1063/// # secret,
1064/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1065/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1066/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1067/// # ),
1068/// # ).build().await.unwrap();
1069///
1070/// # let client = hyper_util::client::legacy::Client::builder(
1071/// # hyper_util::rt::TokioExecutor::new()
1072/// # )
1073/// # .build(
1074/// # hyper_rustls::HttpsConnectorBuilder::new()
1075/// # .with_native_roots()
1076/// # .unwrap()
1077/// # .https_or_http()
1078/// # .enable_http2()
1079/// # .build()
1080/// # );
1081/// # let mut hub = FirebaseML::new(client, auth);
1082/// // You can configure optional parameters by calling the respective setters at will, and
1083/// // execute the final call using `doit()`.
1084/// // Values shown here are possibly random and not representative !
1085/// let result = hub.operations().list("name")
1086/// .return_partial_success(true)
1087/// .page_token("duo")
1088/// .page_size(-50)
1089/// .filter("sed")
1090/// .doit().await;
1091/// # }
1092/// ```
1093pub struct OperationListCall<'a, C>
1094where
1095 C: 'a,
1096{
1097 hub: &'a FirebaseML<C>,
1098 _name: String,
1099 _return_partial_success: Option<bool>,
1100 _page_token: Option<String>,
1101 _page_size: Option<i32>,
1102 _filter: Option<String>,
1103 _delegate: Option<&'a mut dyn common::Delegate>,
1104 _additional_params: HashMap<String, String>,
1105 _scopes: BTreeSet<String>,
1106}
1107
1108impl<'a, C> common::CallBuilder for OperationListCall<'a, C> {}
1109
1110impl<'a, C> OperationListCall<'a, C>
1111where
1112 C: common::Connector,
1113{
1114 /// Perform the operation you have build so far.
1115 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
1116 use std::borrow::Cow;
1117 use std::io::{Read, Seek};
1118
1119 use common::{url::Params, ToParts};
1120 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1121
1122 let mut dd = common::DefaultDelegate;
1123 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1124 dlg.begin(common::MethodInfo {
1125 id: "firebaseml.operations.list",
1126 http_method: hyper::Method::GET,
1127 });
1128
1129 for &field in [
1130 "alt",
1131 "name",
1132 "returnPartialSuccess",
1133 "pageToken",
1134 "pageSize",
1135 "filter",
1136 ]
1137 .iter()
1138 {
1139 if self._additional_params.contains_key(field) {
1140 dlg.finished(false);
1141 return Err(common::Error::FieldClash(field));
1142 }
1143 }
1144
1145 let mut params = Params::with_capacity(7 + self._additional_params.len());
1146 params.push("name", self._name);
1147 if let Some(value) = self._return_partial_success.as_ref() {
1148 params.push("returnPartialSuccess", value.to_string());
1149 }
1150 if let Some(value) = self._page_token.as_ref() {
1151 params.push("pageToken", value);
1152 }
1153 if let Some(value) = self._page_size.as_ref() {
1154 params.push("pageSize", value.to_string());
1155 }
1156 if let Some(value) = self._filter.as_ref() {
1157 params.push("filter", value);
1158 }
1159
1160 params.extend(self._additional_params.iter());
1161
1162 params.push("alt", "json");
1163 let mut url = self.hub._base_url.clone() + "v1/{+name}";
1164 if self._scopes.is_empty() {
1165 self._scopes
1166 .insert(Scope::CloudPlatform.as_ref().to_string());
1167 }
1168
1169 #[allow(clippy::single_element_loop)]
1170 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1171 url = params.uri_replacement(url, param_name, find_this, true);
1172 }
1173 {
1174 let to_remove = ["name"];
1175 params.remove_params(&to_remove);
1176 }
1177
1178 let url = params.parse_with_url(&url);
1179
1180 loop {
1181 let token = match self
1182 .hub
1183 .auth
1184 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1185 .await
1186 {
1187 Ok(token) => token,
1188 Err(e) => match dlg.token(e) {
1189 Ok(token) => token,
1190 Err(e) => {
1191 dlg.finished(false);
1192 return Err(common::Error::MissingToken(e));
1193 }
1194 },
1195 };
1196 let mut req_result = {
1197 let client = &self.hub.client;
1198 dlg.pre_request();
1199 let mut req_builder = hyper::Request::builder()
1200 .method(hyper::Method::GET)
1201 .uri(url.as_str())
1202 .header(USER_AGENT, self.hub._user_agent.clone());
1203
1204 if let Some(token) = token.as_ref() {
1205 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1206 }
1207
1208 let request = req_builder
1209 .header(CONTENT_LENGTH, 0_u64)
1210 .body(common::to_body::<String>(None));
1211
1212 client.request(request.unwrap()).await
1213 };
1214
1215 match req_result {
1216 Err(err) => {
1217 if let common::Retry::After(d) = dlg.http_error(&err) {
1218 sleep(d).await;
1219 continue;
1220 }
1221 dlg.finished(false);
1222 return Err(common::Error::HttpError(err));
1223 }
1224 Ok(res) => {
1225 let (mut parts, body) = res.into_parts();
1226 let mut body = common::Body::new(body);
1227 if !parts.status.is_success() {
1228 let bytes = common::to_bytes(body).await.unwrap_or_default();
1229 let error = serde_json::from_str(&common::to_string(&bytes));
1230 let response = common::to_response(parts, bytes.into());
1231
1232 if let common::Retry::After(d) =
1233 dlg.http_failure(&response, error.as_ref().ok())
1234 {
1235 sleep(d).await;
1236 continue;
1237 }
1238
1239 dlg.finished(false);
1240
1241 return Err(match error {
1242 Ok(value) => common::Error::BadRequest(value),
1243 _ => common::Error::Failure(response),
1244 });
1245 }
1246 let response = {
1247 let bytes = common::to_bytes(body).await.unwrap_or_default();
1248 let encoded = common::to_string(&bytes);
1249 match serde_json::from_str(&encoded) {
1250 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1251 Err(error) => {
1252 dlg.response_json_decode_error(&encoded, &error);
1253 return Err(common::Error::JsonDecodeError(
1254 encoded.to_string(),
1255 error,
1256 ));
1257 }
1258 }
1259 };
1260
1261 dlg.finished(true);
1262 return Ok(response);
1263 }
1264 }
1265 }
1266 }
1267
1268 /// The name of the operation's parent resource.
1269 ///
1270 /// Sets the *name* path property to the given value.
1271 ///
1272 /// Even though the property as already been set when instantiating this call,
1273 /// we provide this method for API completeness.
1274 pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C> {
1275 self._name = new_value.to_string();
1276 self
1277 }
1278 /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
1279 ///
1280 /// Sets the *return partial success* query property to the given value.
1281 pub fn return_partial_success(mut self, new_value: bool) -> OperationListCall<'a, C> {
1282 self._return_partial_success = Some(new_value);
1283 self
1284 }
1285 /// The standard list page token.
1286 ///
1287 /// Sets the *page token* query property to the given value.
1288 pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C> {
1289 self._page_token = Some(new_value.to_string());
1290 self
1291 }
1292 /// The standard list page size.
1293 ///
1294 /// Sets the *page size* query property to the given value.
1295 pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, C> {
1296 self._page_size = Some(new_value);
1297 self
1298 }
1299 /// The standard list filter.
1300 ///
1301 /// Sets the *filter* query property to the given value.
1302 pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C> {
1303 self._filter = Some(new_value.to_string());
1304 self
1305 }
1306 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1307 /// while executing the actual API request.
1308 ///
1309 /// ````text
1310 /// It should be used to handle progress information, and to implement a certain level of resilience.
1311 /// ````
1312 ///
1313 /// Sets the *delegate* property to the given value.
1314 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationListCall<'a, C> {
1315 self._delegate = Some(new_value);
1316 self
1317 }
1318
1319 /// Set any additional parameter of the query string used in the request.
1320 /// It should be used to set parameters which are not yet available through their own
1321 /// setters.
1322 ///
1323 /// Please note that this method must not be used to set any of the known parameters
1324 /// which have their own setter method. If done anyway, the request will fail.
1325 ///
1326 /// # Additional Parameters
1327 ///
1328 /// * *$.xgafv* (query-string) - V1 error format.
1329 /// * *access_token* (query-string) - OAuth access token.
1330 /// * *alt* (query-string) - Data format for response.
1331 /// * *callback* (query-string) - JSONP
1332 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1333 /// * *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.
1334 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1335 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1336 /// * *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.
1337 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1338 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1339 pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a, C>
1340 where
1341 T: AsRef<str>,
1342 {
1343 self._additional_params
1344 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1345 self
1346 }
1347
1348 /// Identifies the authorization scope for the method you are building.
1349 ///
1350 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1351 /// [`Scope::CloudPlatform`].
1352 ///
1353 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1354 /// tokens for more than one scope.
1355 ///
1356 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1357 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1358 /// sufficient, a read-write scope will do as well.
1359 pub fn add_scope<St>(mut self, scope: St) -> OperationListCall<'a, C>
1360 where
1361 St: AsRef<str>,
1362 {
1363 self._scopes.insert(String::from(scope.as_ref()));
1364 self
1365 }
1366 /// Identifies the authorization scope(s) for the method you are building.
1367 ///
1368 /// See [`Self::add_scope()`] for details.
1369 pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationListCall<'a, C>
1370 where
1371 I: IntoIterator<Item = St>,
1372 St: AsRef<str>,
1373 {
1374 self._scopes
1375 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1376 self
1377 }
1378
1379 /// Removes all scopes, and no default scope will be used either.
1380 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1381 /// for details).
1382 pub fn clear_scopes(mut self) -> OperationListCall<'a, C> {
1383 self._scopes.clear();
1384 self
1385 }
1386}