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 = Fcmdata::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// let mut hub = Fcmdata::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 !
@@ -99,34 +104,34 @@ impl Default for Scope {
/// # }
/// ```
#[derive(Clone)]
pub struct Fcmdata<> {
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 Fcmdata<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 Fcmdata<> {}
impl<'a, S> client::Hub for Fcmdata<S> {}
impl<'a, > Fcmdata<> {
impl<'a, S> Fcmdata<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>>) -> Fcmdata<> {
pub fn new(client: hyper::Client<S, hyper::body::Body>, authenticator: oauth2::authenticator::Authenticator<S>) -> Fcmdata<S> {
Fcmdata {
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://fcmdata.googleapis.com/".to_string(),
_root_url: "https://fcmdata.googleapis.com/".to_string(),
}
}
pub fn projects(&'a self) -> ProjectMethods<'a> {
pub fn projects(&'a self) -> ProjectMethods<'a, S> {
ProjectMethods { 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 {
@@ -327,22 +332,22 @@ impl client::Part for GoogleTypeDate {}
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Fcmdata::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// let mut hub = Fcmdata::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 `android_apps_delivery_data_list(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a>
where {
pub struct ProjectMethods<'a, S>
where S: 'a {
hub: &'a Fcmdata<>,
hub: &'a Fcmdata<S>,
}
impl<'a> client::MethodsBuilder for ProjectMethods<'a> {}
impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {}
impl<'a> ProjectMethods<'a> {
impl<'a, S> ProjectMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
@@ -351,7 +356,7 @@ impl<'a> ProjectMethods<'a> {
/// # Arguments
///
/// * `parent` - Required. The application for which to list delivery data. Format: `projects/{project_id}/androidApps/{app_id}`
pub fn android_apps_delivery_data_list(&self, parent: &str) -> ProjectAndroidAppDeliveryDataListCall<'a> {
pub fn android_apps_delivery_data_list(&self, parent: &str) -> ProjectAndroidAppDeliveryDataListCall<'a, S> {
ProjectAndroidAppDeliveryDataListCall {
hub: self.hub,
_parent: parent.to_string(),
@@ -394,7 +399,7 @@ impl<'a> ProjectMethods<'a> {
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = Fcmdata::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
/// # let mut hub = Fcmdata::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 !
@@ -404,10 +409,10 @@ impl<'a> ProjectMethods<'a> {
/// .doit().await;
/// # }
/// ```
pub struct ProjectAndroidAppDeliveryDataListCall<'a>
where {
pub struct ProjectAndroidAppDeliveryDataListCall<'a, S>
where S: 'a {
hub: &'a Fcmdata<>,
hub: &'a Fcmdata<S>,
_parent: String,
_page_token: Option<String>,
_page_size: Option<i32>,
@@ -416,9 +421,15 @@ pub struct ProjectAndroidAppDeliveryDataListCall<'a>
_scopes: BTreeMap<String, ()>
}
impl<'a> client::CallBuilder for ProjectAndroidAppDeliveryDataListCall<'a> {}
impl<'a, S> client::CallBuilder for ProjectAndroidAppDeliveryDataListCall<'a, S> {}
impl<'a> ProjectAndroidAppDeliveryDataListCall<'a> {
impl<'a, S> ProjectAndroidAppDeliveryDataListCall<'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.
@@ -571,21 +582,21 @@ impl<'a> ProjectAndroidAppDeliveryDataListCall<'a> {
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn parent(mut self, new_value: &str) -> ProjectAndroidAppDeliveryDataListCall<'a> {
pub fn parent(mut self, new_value: &str) -> ProjectAndroidAppDeliveryDataListCall<'a, S> {
self._parent = new_value.to_string();
self
}
/// A page token, received from a previous `ListAndroidDeliveryDataRequest` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListAndroidDeliveryDataRequest` must match the call that provided the page token.
///
/// Sets the *page token* query property to the given value.
pub fn page_token(mut self, new_value: &str) -> ProjectAndroidAppDeliveryDataListCall<'a> {
pub fn page_token(mut self, new_value: &str) -> ProjectAndroidAppDeliveryDataListCall<'a, S> {
self._page_token = Some(new_value.to_string());
self
}
/// The maximum number of entries to return. The service may return fewer than this value. If unspecified, at most 1,000 entries will be returned. The maximum value is 10,000; values above 10,000 will be capped to 10,000. This default may change over time.
///
/// Sets the *page size* query property to the given value.
pub fn page_size(mut self, new_value: i32) -> ProjectAndroidAppDeliveryDataListCall<'a> {
pub fn page_size(mut self, new_value: i32) -> ProjectAndroidAppDeliveryDataListCall<'a, S> {
self._page_size = Some(new_value);
self
}
@@ -595,7 +606,7 @@ impl<'a> ProjectAndroidAppDeliveryDataListCall<'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) -> ProjectAndroidAppDeliveryDataListCall<'a> {
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectAndroidAppDeliveryDataListCall<'a, S> {
self._delegate = Some(new_value);
self
}
@@ -620,7 +631,7 @@ impl<'a> ProjectAndroidAppDeliveryDataListCall<'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) -> ProjectAndroidAppDeliveryDataListCall<'a>
pub fn param<T>(mut self, name: T, value: T) -> ProjectAndroidAppDeliveryDataListCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
@@ -640,9 +651,9 @@ impl<'a> ProjectAndroidAppDeliveryDataListCall<'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) -> ProjectAndroidAppDeliveryDataListCall<'a>
where T: Into<Option<S>>,
S: AsRef<str> {
pub fn add_scope<T, St>(mut self, scope: T) -> ProjectAndroidAppDeliveryDataListCall<'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 *Fcmdata* crate version *3.1.0+20220305*, where *20220305* is the exact revision of the *fcmdata:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v3.1.0*.
//! This documentation was generated from *Fcmdata* crate version *4.0.1+20220305*, where *20220305* is the exact revision of the *fcmdata:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v4.0.1*.
//!
//! Everything else about the *Fcmdata* *v1_beta1* API can be found at the
//! [official documentation site](https://firebase.google.com/docs/cloud-messaging).
@@ -91,7 +91,7 @@
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = Fcmdata::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth);
//! let mut hub = Fcmdata::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 !
@@ -180,7 +180,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]