regenerate all APIs and CLIs (#357)

This commit is contained in:
Sebastian Thiel
2022-09-14 08:40:12 +08:00
parent 0e011fcbe2
commit 7abe6a3de2
3505 changed files with 247010 additions and 176785 deletions

View File

@@ -2,12 +2,17 @@ use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeMap;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use std::thread::sleep;
use http::Uri;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tower_service;
use crate::client;
// ##############
@@ -70,7 +75,7 @@ impl Default for Scope {
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
@@ -100,34 +105,34 @@ impl Default for Scope {
/// # }
/// ```
#[derive(Clone)]
pub struct FirebaseML<> {
pub client: hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>,
pub auth: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>,
pub struct FirebaseML<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: oauth2::authenticator::Authenticator<S>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<'a, > client::Hub for FirebaseML<> {}
impl<'a, S> client::Hub for FirebaseML<S> {}
impl<'a, > FirebaseML<> {
impl<'a, S> FirebaseML<S> {
pub fn new(client: hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>, authenticator: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>) -> FirebaseML<> {
pub fn new(client: hyper::Client<S, hyper::body::Body>, authenticator: oauth2::authenticator::Authenticator<S>) -> FirebaseML<S> {
FirebaseML {
client,
auth: authenticator,
_user_agent: "google-api-rust-client/3.1.0".to_string(),
_user_agent: "google-api-rust-client/4.0.1".to_string(),
_base_url: "https://firebaseml.googleapis.com/".to_string(),
_root_url: "https://firebaseml.googleapis.com/".to_string(),
}
}
pub fn operations(&'a self) -> OperationMethods<'a> {
pub fn operations(&'a self) -> OperationMethods<'a, S> {
OperationMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/3.1.0`.
/// It defaults to `google-api-rust-client/4.0.1`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
@@ -278,22 +283,22 @@ impl client::Part for Status {}
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `cancel(...)`, `delete(...)` and `list(...)`
/// // to build up your call.
/// let rb = hub.operations();
/// # }
/// ```
pub struct OperationMethods<'a>
where {
pub struct OperationMethods<'a, S>
where S: 'a {
hub: &'a FirebaseML<>,
hub: &'a FirebaseML<S>,
}
impl<'a> client::MethodsBuilder for OperationMethods<'a> {}
impl<'a, S> client::MethodsBuilder for OperationMethods<'a, S> {}
impl<'a> OperationMethods<'a> {
impl<'a, S> OperationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
@@ -303,7 +308,7 @@ impl<'a> OperationMethods<'a> {
///
/// * `request` - No description provided.
/// * `name` - The name of the operation resource to be cancelled.
pub fn cancel(&self, request: CancelOperationRequest, name: &str) -> OperationCancelCall<'a> {
pub fn cancel(&self, request: CancelOperationRequest, name: &str) -> OperationCancelCall<'a, S> {
OperationCancelCall {
hub: self.hub,
_request: request,
@@ -321,7 +326,7 @@ impl<'a> OperationMethods<'a> {
/// # Arguments
///
/// * `name` - The name of the operation resource to be deleted.
pub fn delete(&self, name: &str) -> OperationDeleteCall<'a> {
pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, S> {
OperationDeleteCall {
hub: self.hub,
_name: name.to_string(),
@@ -338,7 +343,7 @@ impl<'a> OperationMethods<'a> {
/// # Arguments
///
/// * `name` - The name of the operation's parent resource.
pub fn list(&self, name: &str) -> OperationListCall<'a> {
pub fn list(&self, name: &str) -> OperationListCall<'a, S> {
OperationListCall {
hub: self.hub,
_name: name.to_string(),
@@ -383,7 +388,7 @@ impl<'a> OperationMethods<'a> {
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// # let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
@@ -396,10 +401,10 @@ impl<'a> OperationMethods<'a> {
/// .doit().await;
/// # }
/// ```
pub struct OperationCancelCall<'a>
where {
pub struct OperationCancelCall<'a, S>
where S: 'a {
hub: &'a FirebaseML<>,
hub: &'a FirebaseML<S>,
_request: CancelOperationRequest,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
@@ -407,9 +412,15 @@ pub struct OperationCancelCall<'a>
_scopes: BTreeMap<String, ()>
}
impl<'a> client::CallBuilder for OperationCancelCall<'a> {}
impl<'a, S> client::CallBuilder for OperationCancelCall<'a, S> {}
impl<'a> OperationCancelCall<'a> {
impl<'a, S> OperationCancelCall<'a, S>
where
S: tower_service::Service<Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Perform the operation you have build so far.
@@ -569,7 +580,7 @@ impl<'a> OperationCancelCall<'a> {
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: CancelOperationRequest) -> OperationCancelCall<'a> {
pub fn request(mut self, new_value: CancelOperationRequest) -> OperationCancelCall<'a, S> {
self._request = new_value;
self
}
@@ -579,7 +590,7 @@ impl<'a> OperationCancelCall<'a> {
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a> {
pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a, S> {
self._name = new_value.to_string();
self
}
@@ -589,7 +600,7 @@ impl<'a> OperationCancelCall<'a> {
/// It should be used to handle progress information, and to implement a certain level of resilience.
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> OperationCancelCall<'a> {
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> OperationCancelCall<'a, S> {
self._delegate = Some(new_value);
self
}
@@ -614,7 +625,7 @@ impl<'a> OperationCancelCall<'a> {
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> OperationCancelCall<'a>
pub fn param<T>(mut self, name: T, value: T) -> OperationCancelCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
@@ -634,9 +645,9 @@ impl<'a> OperationCancelCall<'a> {
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<T, S>(mut self, scope: T) -> OperationCancelCall<'a>
where T: Into<Option<S>>,
S: AsRef<str> {
pub fn add_scope<T, St>(mut self, scope: T) -> OperationCancelCall<'a, S>
where T: Into<Option<St>>,
St: AsRef<str> {
match scope.into() {
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
None => None,
@@ -668,7 +679,7 @@ impl<'a> OperationCancelCall<'a> {
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// # let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
@@ -676,19 +687,25 @@ impl<'a> OperationCancelCall<'a> {
/// .doit().await;
/// # }
/// ```
pub struct OperationDeleteCall<'a>
where {
pub struct OperationDeleteCall<'a, S>
where S: 'a {
hub: &'a FirebaseML<>,
hub: &'a FirebaseML<S>,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeMap<String, ()>
}
impl<'a> client::CallBuilder for OperationDeleteCall<'a> {}
impl<'a, S> client::CallBuilder for OperationDeleteCall<'a, S> {}
impl<'a> OperationDeleteCall<'a> {
impl<'a, S> OperationDeleteCall<'a, S>
where
S: tower_service::Service<Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Perform the operation you have build so far.
@@ -835,7 +852,7 @@ impl<'a> OperationDeleteCall<'a> {
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> OperationDeleteCall<'a> {
pub fn name(mut self, new_value: &str) -> OperationDeleteCall<'a, S> {
self._name = new_value.to_string();
self
}
@@ -845,7 +862,7 @@ impl<'a> OperationDeleteCall<'a> {
/// It should be used to handle progress information, and to implement a certain level of resilience.
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> OperationDeleteCall<'a> {
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> OperationDeleteCall<'a, S> {
self._delegate = Some(new_value);
self
}
@@ -870,7 +887,7 @@ impl<'a> OperationDeleteCall<'a> {
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> OperationDeleteCall<'a>
pub fn param<T>(mut self, name: T, value: T) -> OperationDeleteCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
@@ -890,9 +907,9 @@ impl<'a> OperationDeleteCall<'a> {
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<T, S>(mut self, scope: T) -> OperationDeleteCall<'a>
where T: Into<Option<S>>,
S: AsRef<str> {
pub fn add_scope<T, St>(mut self, scope: T) -> OperationDeleteCall<'a, S>
where T: Into<Option<St>>,
St: AsRef<str> {
match scope.into() {
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
None => None,
@@ -924,7 +941,7 @@ impl<'a> OperationDeleteCall<'a> {
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// # let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
@@ -935,10 +952,10 @@ impl<'a> OperationDeleteCall<'a> {
/// .doit().await;
/// # }
/// ```
pub struct OperationListCall<'a>
where {
pub struct OperationListCall<'a, S>
where S: 'a {
hub: &'a FirebaseML<>,
hub: &'a FirebaseML<S>,
_name: String,
_page_token: Option<String>,
_page_size: Option<i32>,
@@ -948,9 +965,15 @@ pub struct OperationListCall<'a>
_scopes: BTreeMap<String, ()>
}
impl<'a> client::CallBuilder for OperationListCall<'a> {}
impl<'a, S> client::CallBuilder for OperationListCall<'a, S> {}
impl<'a> OperationListCall<'a> {
impl<'a, S> OperationListCall<'a, S>
where
S: tower_service::Service<Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Perform the operation you have build so far.
@@ -1106,28 +1129,28 @@ impl<'a> OperationListCall<'a> {
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> OperationListCall<'a> {
pub fn name(mut self, new_value: &str) -> OperationListCall<'a, S> {
self._name = new_value.to_string();
self
}
/// The standard list page token.
///
/// Sets the *page token* query property to the given value.
pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a> {
pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, S> {
self._page_token = Some(new_value.to_string());
self
}
/// The standard list page size.
///
/// Sets the *page size* query property to the given value.
pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a> {
pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, S> {
self._page_size = Some(new_value);
self
}
/// The standard list filter.
///
/// Sets the *filter* query property to the given value.
pub fn filter(mut self, new_value: &str) -> OperationListCall<'a> {
pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, S> {
self._filter = Some(new_value.to_string());
self
}
@@ -1137,7 +1160,7 @@ impl<'a> OperationListCall<'a> {
/// It should be used to handle progress information, and to implement a certain level of resilience.
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> OperationListCall<'a> {
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> OperationListCall<'a, S> {
self._delegate = Some(new_value);
self
}
@@ -1162,7 +1185,7 @@ impl<'a> OperationListCall<'a> {
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a>
pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
@@ -1182,9 +1205,9 @@ impl<'a> OperationListCall<'a> {
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<T, S>(mut self, scope: T) -> OperationListCall<'a>
where T: Into<Option<S>>,
S: AsRef<str> {
pub fn add_scope<T, St>(mut self, scope: T) -> OperationListCall<'a, S>
where T: Into<Option<St>>,
St: AsRef<str> {
match scope.into() {
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
None => None,

View File

@@ -1,6 +1,7 @@
// COPY OF 'src/rust/api/client.rs'
// DO NOT EDIT
use std::error;
use std::error::Error as StdError;
use std::fmt::{self, Display};
use std::io::{self, Cursor, Read, Seek, SeekFrom, Write};
use std::str::FromStr;
@@ -9,7 +10,10 @@ use std::time::Duration;
use itertools::Itertools;
use hyper::http::Uri;
use hyper::body::Buf;
use hyper::client::connect;
use hyper::header::{HeaderMap, AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, USER_AGENT};
use hyper::Method;
use hyper::StatusCode;
@@ -18,6 +22,9 @@ use mime::{Attr, Mime, SubLevel, TopLevel, Value};
use serde_json as json;
use tokio::io::{AsyncRead, AsyncWrite};
use tower_service;
const LINE_ENDING: &str = "\r\n";
pub enum Retry {
@@ -566,9 +573,15 @@ impl RangeResponseHeader {
}
/// A utility type to perform a resumable upload from start to end.
pub struct ResumableUploadHelper<'a, A: 'a> {
pub struct ResumableUploadHelper<'a, A: 'a, S>
where
S: tower_service::Service<Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
pub client: &'a hyper::client::Client<
hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>,
S,
hyper::body::Body,
>,
pub delegate: &'a mut dyn Delegate,
@@ -582,7 +595,13 @@ pub struct ResumableUploadHelper<'a, A: 'a> {
pub content_length: u64,
}
impl<'a, A> ResumableUploadHelper<'a, A> {
impl<'a, A, S> ResumableUploadHelper<'a, A, S>
where
S: tower_service::Service<Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
async fn query_transfer_status(
&mut self,
) -> std::result::Result<u64, hyper::Result<hyper::Response<hyper::body::Body>>> {
@@ -697,14 +716,11 @@ impl<'a, A> ResumableUploadHelper<'a, A> {
}
let (res_parts, res_body) = res.into_parts();
let res_body_string: String = String::from_utf8(
hyper::body::to_bytes(res_body)
.await
.unwrap()
.into_iter()
.collect(),
)
.unwrap();
let res_body = match hyper::body::to_bytes(res_body).await {
Ok(res_body) => res_body.into_iter().collect(),
Err(err) => return Some(Err(err)),
};
let res_body_string: String = String::from_utf8(res_body).unwrap();
let reconstructed_result =
hyper::Response::from_parts(res_parts, res_body_string.clone().into());

View File

@@ -1,8 +1,8 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Firebase ML* crate version *3.1.0+20220302*, where *20220302* is the exact revision of the *firebaseml:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v3.1.0*.
//! This documentation was generated from *Firebase ML* crate version *4.0.1+20220302*, where *20220302* is the exact revision of the *firebaseml:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v4.0.1*.
//!
//! Everything else about the *Firebase ML* *v1* API can be found at the
//! [official documentation site](https://firebase.google.com).
@@ -93,7 +93,7 @@
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
//! let mut hub = FirebaseML::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
@@ -183,7 +183,7 @@
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
#[macro_use]