regenerate everything

This commit is contained in:
Sebastian Thiel
2021-04-14 10:10:59 +08:00
parent 65f9c22094
commit 34096d3862
2792 changed files with 149735 additions and 162953 deletions

View File

@@ -4,12 +4,12 @@
[package]
name = "google-speech1"
version = "2.0.0+20210325"
version = "2.0.3+20210325"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Speech (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/speech1"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/speech1"
homepage = "https://cloud.google.com/speech-to-text/docs/quickstart-protocol"
documentation = "https://docs.rs/google-speech1/2.0.0+20210325"
documentation = "https://docs.rs/google-speech1/2.0.3+20210325"
license = "MIT"
keywords = ["speech", "google", "protocol", "web", "api"]
autobins = false

View File

@@ -5,18 +5,18 @@ DO NOT EDIT !
-->
The `google-speech1` library allows access to all features of the *Google Speech* service.
This documentation was generated from *Speech* crate version *2.0.0+20210325*, where *20210325* is the exact revision of the *speech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v2.0.0*.
This documentation was generated from *Speech* crate version *2.0.3+20210325*, where *20210325* is the exact revision of the *speech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v2.0.3*.
Everything else about the *Speech* *v1* API can be found at the
[official documentation site](https://cloud.google.com/speech-to-text/docs/quickstart-protocol).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/Speech) ...
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/Speech) ...
* [operations](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/api::Operation)
* [*get*](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/api::OperationGetCall) and [*list*](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/api::OperationListCall)
* [operations](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/api::Operation)
* [*get*](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/api::OperationGetCall) and [*list*](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/api::OperationListCall)
* speech
* [*longrunningrecognize*](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/api::SpeechLongrunningrecognizeCall) and [*recognize*](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/api::SpeechRecognizeCall)
* [*longrunningrecognize*](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/api::SpeechLongrunningrecognizeCall) and [*recognize*](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/api::SpeechRecognizeCall)
@@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/Speech)**
* **[Hub](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/Speech)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::CallBuilder)
* **[Resources](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::Resource)**
* creates [*Method Builders*](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::CallBuilder)
* **[Resources](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::Part)**
* **[Parts](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::CallBuilder)**
* **[Activities](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
@@ -134,17 +134,17 @@ match result {
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::Result) enumeration as return value of
All errors produced by the system are provided either as [Result](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
[Hub Delegate](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
makes the system potentially resilient to all kinds of errors.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::Result), should be
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::ResponseResult), it will return that by default.
If such a method also supports a [Response Result](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::ResponseResult), it will return that by default.
You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
this call: `.param("alt", "media")`.
@@ -154,29 +154,29 @@ Methods supporting uploads can do so using up to 2 different protocols:
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::Delegate) to the
[Method Builder](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::CallBuilder) before making the final `doit()` call.
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::Delegate) to the
[Method Builder](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
The [delegate trait](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::RequestValue) and
[decodable](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
All structures provided by this library are made to be [encodable](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::RequestValue) and
[decodable](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::Part) which are identifiable by name, which will be sent to
Most optionals are are considered [Parts](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::Part) which are identifiable by name, which will be sent to
the server to indicate either the set parts of the request or the desired parts in the response.
## Builder Arguments
Using [method builders](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
Using [method builders](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
These will always take a single argument, for which the following statements are true.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-speech1/2.0.0+20210325/google_speech1/client::RequestValue) are moved
* [request values](https://docs.rs/google-speech1/2.0.3+20210325/google_speech1/client::RequestValue) are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
@@ -189,4 +189,4 @@ The **speech1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

View File

@@ -1,6 +1,5 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::borrow::BorrowMut;
use std::default::Default;
use std::collections::BTreeMap;
use serde_json as json;
@@ -103,38 +102,37 @@ impl Default for Scope {
/// }
/// # }
/// ```
pub struct Speech<C> {
client: RefCell<C>,
auth: RefCell<oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>>,
pub struct Speech<> {
client: hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>,
auth: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<'a, C> client::Hub for Speech<C> {}
impl<'a, > client::Hub for Speech<> {}
impl<'a, C> Speech<C>
where C: BorrowMut<hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>> {
impl<'a, > Speech<> {
pub fn new(client: C, authenticator: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>) -> Speech<C> {
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>>) -> Speech<> {
Speech {
client: RefCell::new(client),
auth: RefCell::new(authenticator),
_user_agent: "google-api-rust-client/2.0.0".to_string(),
client,
auth: authenticator,
_user_agent: "google-api-rust-client/2.0.3".to_string(),
_base_url: "https://speech.googleapis.com/".to_string(),
_root_url: "https://speech.googleapis.com/".to_string(),
}
}
pub fn operations(&'a self) -> OperationMethods<'a, C> {
pub fn operations(&'a self) -> OperationMethods<'a> {
OperationMethods { hub: &self }
}
pub fn speech(&'a self) -> SpeechMethods<'a, C> {
pub fn speech(&'a self) -> SpeechMethods<'a> {
SpeechMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/2.0.0`.
/// It defaults to `google-api-rust-client/2.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
@@ -513,15 +511,15 @@ impl client::Part for WordInfo {}
/// let rb = hub.operations();
/// # }
/// ```
pub struct OperationMethods<'a, C>
where C: 'a {
pub struct OperationMethods<'a>
where {
hub: &'a Speech<C>,
hub: &'a Speech<>,
}
impl<'a, C> client::MethodsBuilder for OperationMethods<'a, C> {}
impl<'a> client::MethodsBuilder for OperationMethods<'a> {}
impl<'a, C> OperationMethods<'a, C> {
impl<'a> OperationMethods<'a> {
/// Create a builder to help you perform the following task:
///
@@ -530,7 +528,7 @@ impl<'a, C> OperationMethods<'a, C> {
/// # Arguments
///
/// * `name` - The name of the operation resource.
pub fn get(&self, name: &str) -> OperationGetCall<'a, C> {
pub fn get(&self, name: &str) -> OperationGetCall<'a> {
OperationGetCall {
hub: self.hub,
_name: name.to_string(),
@@ -543,7 +541,7 @@ impl<'a, C> OperationMethods<'a, C> {
/// Create a builder to help you perform the following task:
///
/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
pub fn list(&self) -> OperationListCall<'a, C> {
pub fn list(&self) -> OperationListCall<'a> {
OperationListCall {
hub: self.hub,
_page_token: Default::default(),
@@ -589,15 +587,15 @@ impl<'a, C> OperationMethods<'a, C> {
/// let rb = hub.speech();
/// # }
/// ```
pub struct SpeechMethods<'a, C>
where C: 'a {
pub struct SpeechMethods<'a>
where {
hub: &'a Speech<C>,
hub: &'a Speech<>,
}
impl<'a, C> client::MethodsBuilder for SpeechMethods<'a, C> {}
impl<'a> client::MethodsBuilder for SpeechMethods<'a> {}
impl<'a, C> SpeechMethods<'a, C> {
impl<'a> SpeechMethods<'a> {
/// Create a builder to help you perform the following task:
///
@@ -606,7 +604,7 @@ impl<'a, C> SpeechMethods<'a, C> {
/// # Arguments
///
/// * `request` - No description provided.
pub fn longrunningrecognize(&self, request: LongRunningRecognizeRequest) -> SpeechLongrunningrecognizeCall<'a, C> {
pub fn longrunningrecognize(&self, request: LongRunningRecognizeRequest) -> SpeechLongrunningrecognizeCall<'a> {
SpeechLongrunningrecognizeCall {
hub: self.hub,
_request: request,
@@ -623,7 +621,7 @@ impl<'a, C> SpeechMethods<'a, C> {
/// # Arguments
///
/// * `request` - No description provided.
pub fn recognize(&self, request: RecognizeRequest) -> SpeechRecognizeCall<'a, C> {
pub fn recognize(&self, request: RecognizeRequest) -> SpeechRecognizeCall<'a> {
SpeechRecognizeCall {
hub: self.hub,
_request: request,
@@ -674,19 +672,19 @@ impl<'a, C> SpeechMethods<'a, C> {
/// .doit().await;
/// # }
/// ```
pub struct OperationGetCall<'a, C>
where C: 'a {
pub struct OperationGetCall<'a>
where {
hub: &'a Speech<C>,
hub: &'a Speech<>,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeMap<String, ()>
}
impl<'a, C> client::CallBuilder for OperationGetCall<'a, C> {}
impl<'a> client::CallBuilder for OperationGetCall<'a> {}
impl<'a, C> OperationGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>> {
impl<'a> OperationGetCall<'a> {
/// Perform the operation you have build so far.
@@ -751,8 +749,7 @@ impl<'a, C> OperationGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustl
loop {
let authenticator = self.hub.auth.borrow_mut();
let token = match authenticator.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
Ok(token) => token.clone(),
Err(err) => {
match dlg.token(&err) {
@@ -765,7 +762,7 @@ impl<'a, C> OperationGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustl
}
};
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
@@ -774,7 +771,7 @@ impl<'a, C> OperationGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustl
let request = req_builder
.body(hyper::body::Body::empty());
client.borrow_mut().request(request.unwrap()).await
client.request(request.unwrap()).await
};
@@ -834,7 +831,7 @@ impl<'a, C> OperationGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustl
///
/// 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) -> OperationGetCall<'a, C> {
pub fn name(mut self, new_value: &str) -> OperationGetCall<'a> {
self._name = new_value.to_string();
self
}
@@ -844,7 +841,7 @@ impl<'a, C> OperationGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustl
/// 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) -> OperationGetCall<'a, C> {
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> OperationGetCall<'a> {
self._delegate = Some(new_value);
self
}
@@ -869,7 +866,7 @@ impl<'a, C> OperationGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustl
/// * *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) -> OperationGetCall<'a, C>
pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
@@ -889,7 +886,7 @@ impl<'a, C> OperationGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustl
/// 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) -> OperationGetCall<'a, C>
pub fn add_scope<T, S>(mut self, scope: T) -> OperationGetCall<'a>
where T: Into<Option<S>>,
S: AsRef<str> {
match scope.into() {
@@ -937,10 +934,10 @@ impl<'a, C> OperationGetCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustl
/// .doit().await;
/// # }
/// ```
pub struct OperationListCall<'a, C>
where C: 'a {
pub struct OperationListCall<'a>
where {
hub: &'a Speech<C>,
hub: &'a Speech<>,
_page_token: Option<String>,
_page_size: Option<i32>,
_name: Option<String>,
@@ -950,9 +947,9 @@ pub struct OperationListCall<'a, C>
_scopes: BTreeMap<String, ()>
}
impl<'a, C> client::CallBuilder for OperationListCall<'a, C> {}
impl<'a> client::CallBuilder for OperationListCall<'a> {}
impl<'a, C> OperationListCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>> {
impl<'a> OperationListCall<'a> {
/// Perform the operation you have build so far.
@@ -1003,8 +1000,7 @@ impl<'a, C> OperationListCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
loop {
let authenticator = self.hub.auth.borrow_mut();
let token = match authenticator.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
Ok(token) => token.clone(),
Err(err) => {
match dlg.token(&err) {
@@ -1017,7 +1013,7 @@ impl<'a, C> OperationListCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
}
};
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string())
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
@@ -1026,7 +1022,7 @@ impl<'a, C> OperationListCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
let request = req_builder
.body(hyper::body::Body::empty());
client.borrow_mut().request(request.unwrap()).await
client.request(request.unwrap()).await
};
@@ -1083,28 +1079,28 @@ impl<'a, C> OperationListCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
/// 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, C> {
pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a> {
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, C> {
pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a> {
self._page_size = Some(new_value);
self
}
/// The name of the operation's parent resource.
///
/// Sets the *name* query property to the given value.
pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C> {
pub fn name(mut self, new_value: &str) -> OperationListCall<'a> {
self._name = Some(new_value.to_string());
self
}
/// The standard list filter.
///
/// Sets the *filter* query property to the given value.
pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C> {
pub fn filter(mut self, new_value: &str) -> OperationListCall<'a> {
self._filter = Some(new_value.to_string());
self
}
@@ -1114,7 +1110,7 @@ impl<'a, C> OperationListCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
/// 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, C> {
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> OperationListCall<'a> {
self._delegate = Some(new_value);
self
}
@@ -1139,7 +1135,7 @@ impl<'a, C> OperationListCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
/// * *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, C>
pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
@@ -1159,7 +1155,7 @@ impl<'a, C> OperationListCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
/// 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, C>
pub fn add_scope<T, S>(mut self, scope: T) -> OperationListCall<'a>
where T: Into<Option<S>>,
S: AsRef<str> {
match scope.into() {
@@ -1209,19 +1205,19 @@ impl<'a, C> OperationListCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rust
/// .doit().await;
/// # }
/// ```
pub struct SpeechLongrunningrecognizeCall<'a, C>
where C: 'a {
pub struct SpeechLongrunningrecognizeCall<'a>
where {
hub: &'a Speech<C>,
hub: &'a Speech<>,
_request: LongRunningRecognizeRequest,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeMap<String, ()>
}
impl<'a, C> client::CallBuilder for SpeechLongrunningrecognizeCall<'a, C> {}
impl<'a> client::CallBuilder for SpeechLongrunningrecognizeCall<'a> {}
impl<'a, C> SpeechLongrunningrecognizeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>> {
impl<'a> SpeechLongrunningrecognizeCall<'a> {
/// Perform the operation you have build so far.
@@ -1271,8 +1267,7 @@ impl<'a, C> SpeechLongrunningrecognizeCall<'a, C> where C: BorrowMut<hyper::Clie
loop {
let authenticator = self.hub.auth.borrow_mut();
let token = match authenticator.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
Ok(token) => token.clone(),
Err(err) => {
match dlg.token(&err) {
@@ -1286,7 +1281,7 @@ impl<'a, C> SpeechLongrunningrecognizeCall<'a, C> where C: BorrowMut<hyper::Clie
};
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
@@ -1297,7 +1292,7 @@ impl<'a, C> SpeechLongrunningrecognizeCall<'a, C> where C: BorrowMut<hyper::Clie
.header(CONTENT_LENGTH, request_size as u64)
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
client.borrow_mut().request(request.unwrap()).await
client.request(request.unwrap()).await
};
@@ -1356,7 +1351,7 @@ impl<'a, C> SpeechLongrunningrecognizeCall<'a, C> where C: BorrowMut<hyper::Clie
///
/// 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: LongRunningRecognizeRequest) -> SpeechLongrunningrecognizeCall<'a, C> {
pub fn request(mut self, new_value: LongRunningRecognizeRequest) -> SpeechLongrunningrecognizeCall<'a> {
self._request = new_value;
self
}
@@ -1366,7 +1361,7 @@ impl<'a, C> SpeechLongrunningrecognizeCall<'a, C> where C: BorrowMut<hyper::Clie
/// 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) -> SpeechLongrunningrecognizeCall<'a, C> {
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpeechLongrunningrecognizeCall<'a> {
self._delegate = Some(new_value);
self
}
@@ -1391,7 +1386,7 @@ impl<'a, C> SpeechLongrunningrecognizeCall<'a, C> where C: BorrowMut<hyper::Clie
/// * *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) -> SpeechLongrunningrecognizeCall<'a, C>
pub fn param<T>(mut self, name: T, value: T) -> SpeechLongrunningrecognizeCall<'a>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
@@ -1411,7 +1406,7 @@ impl<'a, C> SpeechLongrunningrecognizeCall<'a, C> where C: BorrowMut<hyper::Clie
/// 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) -> SpeechLongrunningrecognizeCall<'a, C>
pub fn add_scope<T, S>(mut self, scope: T) -> SpeechLongrunningrecognizeCall<'a>
where T: Into<Option<S>>,
S: AsRef<str> {
match scope.into() {
@@ -1461,19 +1456,19 @@ impl<'a, C> SpeechLongrunningrecognizeCall<'a, C> where C: BorrowMut<hyper::Clie
/// .doit().await;
/// # }
/// ```
pub struct SpeechRecognizeCall<'a, C>
where C: 'a {
pub struct SpeechRecognizeCall<'a>
where {
hub: &'a Speech<C>,
hub: &'a Speech<>,
_request: RecognizeRequest,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeMap<String, ()>
}
impl<'a, C> client::CallBuilder for SpeechRecognizeCall<'a, C> {}
impl<'a> client::CallBuilder for SpeechRecognizeCall<'a> {}
impl<'a, C> SpeechRecognizeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>> {
impl<'a> SpeechRecognizeCall<'a> {
/// Perform the operation you have build so far.
@@ -1523,8 +1518,7 @@ impl<'a, C> SpeechRecognizeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
loop {
let authenticator = self.hub.auth.borrow_mut();
let token = match authenticator.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
Ok(token) => token.clone(),
Err(err) => {
match dlg.token(&err) {
@@ -1538,7 +1532,7 @@ impl<'a, C> SpeechRecognizeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
};
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string())
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
@@ -1549,7 +1543,7 @@ impl<'a, C> SpeechRecognizeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
.header(CONTENT_LENGTH, request_size as u64)
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
client.borrow_mut().request(request.unwrap()).await
client.request(request.unwrap()).await
};
@@ -1608,7 +1602,7 @@ impl<'a, C> SpeechRecognizeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
///
/// 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: RecognizeRequest) -> SpeechRecognizeCall<'a, C> {
pub fn request(mut self, new_value: RecognizeRequest) -> SpeechRecognizeCall<'a> {
self._request = new_value;
self
}
@@ -1618,7 +1612,7 @@ impl<'a, C> SpeechRecognizeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
/// 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) -> SpeechRecognizeCall<'a, C> {
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SpeechRecognizeCall<'a> {
self._delegate = Some(new_value);
self
}
@@ -1643,7 +1637,7 @@ impl<'a, C> SpeechRecognizeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
/// * *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) -> SpeechRecognizeCall<'a, C>
pub fn param<T>(mut self, name: T, value: T) -> SpeechRecognizeCall<'a>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
@@ -1663,7 +1657,7 @@ impl<'a, C> SpeechRecognizeCall<'a, C> where C: BorrowMut<hyper::Client<hyper_ru
/// 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) -> SpeechRecognizeCall<'a, C>
pub fn add_scope<T, S>(mut self, scope: T) -> SpeechRecognizeCall<'a>
where T: Into<Option<S>>,
S: AsRef<str> {
match scope.into() {

View File

@@ -1,6 +1,5 @@
// COPY OF 'src/rust/api/client.rs'
// DO NOT EDIT
use std;
use std::error;
use std::fmt::{self, Display};
use std::io::{self, Cursor, Read, Seek, SeekFrom, Write};
@@ -10,18 +9,16 @@ use std::time::Duration;
use itertools::Itertools;
use hyper;
use hyper::body::Buf;
use hyper::header::{HeaderMap, AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, USER_AGENT};
use hyper::Method;
use hyper::StatusCode;
use hyper::body::Buf;
use mime::{Attr, Mime, SubLevel, TopLevel, Value};
use oauth2;
use serde_json as json;
const LINE_ENDING: &'static str = "\r\n";
const LINE_ENDING: &str = "\r\n";
pub enum Retry {
/// Signal you don't want to retry
@@ -307,9 +304,9 @@ impl Display for Error {
err.domain,
err.message,
err.reason,
match &err.location {
&Some(ref loc) => format!("@{}", loc),
&None => String::new(),
match err.location {
Some(ref loc) => format!("@{}", loc),
None => String::new(),
}
)?;
}
@@ -357,7 +354,7 @@ pub struct MethodInfo {
pub http_method: Method,
}
const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d";
const BOUNDARY: &str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d";
/// Provides a `Read` interface that converts multiple parts into the protocol
/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387).
@@ -418,14 +415,14 @@ impl<'a> MultiPartReader<'a> {
/// Returns true if we are totally used
fn is_depleted(&self) -> bool {
self.raw_parts.len() == 0
self.raw_parts.is_empty()
&& self.current_part.is_none()
&& self.last_part_boundary.is_none()
}
/// Returns true if we are handling our last part
fn is_last_part(&self) -> bool {
self.raw_parts.len() == 0 && self.current_part.is_some()
self.raw_parts.is_empty() && self.current_part.is_some()
}
}
@@ -520,12 +517,12 @@ pub struct XUploadContentType(pub Mime);
impl ::std::ops::Deref for XUploadContentType {
type Target = Mime;
fn deref<'a>(&'a self) -> &'a Mime {
fn deref(&self) -> &Mime {
&self.0
}
}
impl ::std::ops::DerefMut for XUploadContentType {
fn deref_mut<'a>(&'a mut self) -> &'a mut Mime {
fn deref_mut(&mut self) -> &mut Mime {
&mut self.0
}
}
@@ -595,11 +592,11 @@ pub struct RangeResponseHeader(pub Chunk);
impl RangeResponseHeader {
fn from_bytes(raw: &[u8]) -> Self {
if raw.len() > 0 {
if !raw.is_empty() {
if let Ok(s) = std::str::from_utf8(raw) {
const PREFIX: &'static str = "bytes ";
if s.starts_with(PREFIX) {
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
const PREFIX: &str = "bytes ";
if let Some(stripped) = s.strip_prefix(PREFIX) {
if let Ok(c) = <Chunk as FromStr>::from_str(&stripped) {
return RangeResponseHeader(c);
}
}
@@ -612,13 +609,13 @@ impl RangeResponseHeader {
/// A utility type to perform a resumable upload from start to end.
pub struct ResumableUploadHelper<'a, A: 'a> {
pub client: &'a mut hyper::client::Client<
pub client: &'a hyper::client::Client<
hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>,
hyper::body::Body,
>,
pub delegate: &'a mut dyn Delegate,
pub start_at: Option<u64>,
pub auth: &'a mut A,
pub auth: &'a A,
pub user_agent: &'a str,
pub auth_header: String,
pub url: &'a str,
@@ -810,7 +807,7 @@ pub fn remove_json_null_values(value: &mut json::value::Value) {
// Borrowing the body object as mutable and converts it to a string
pub async fn get_body_as_string(res_body: &mut hyper::Body) -> String {
let res_body_buf = hyper::body::aggregate(res_body).await.unwrap();
let res_body_string = String::from_utf8_lossy(res_body_buf.chunk());
let res_body_buf = hyper::body::to_bytes(res_body).await.unwrap();
let res_body_string = String::from_utf8_lossy(&res_body_buf);
res_body_string.to_string()
}

View File

@@ -2,11 +2,11 @@
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Speech* crate version *2.0.0+20210325*, where *20210325* is the exact revision of the *speech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v2.0.0*.
//! This documentation was generated from *Speech* crate version *2.0.3+20210325*, where *20210325* is the exact revision of the *speech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v2.0.3*.
//!
//! Everything else about the *Speech* *v1* API can be found at the
//! [official documentation site](https://cloud.google.com/speech-to-text/docs/quickstart-protocol).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/speech1).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/speech1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](Speech) ...