diff --git a/etc/api/drive/v3/crates/4.0.0-api+20220225 b/etc/api/drive/v3/crates/4.0.0-api+20220225 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/gen/drive3-cli/Cargo.toml b/gen/drive3-cli/Cargo.toml index e153a51d65..4bd1ed76b3 100644 --- a/gen/drive3-cli/Cargo.toml +++ b/gen/drive3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive3-cli" -version = "3.1.0+20220225" +version = "4.0.0+20220225" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/drive3-cli" @@ -25,16 +25,18 @@ mime = "^ 0.2.0" serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" -yup-oauth2 = "^ 6.6" +yup-oauth2 = "^ 7.0" itertools = "^ 0.10" strsim = "^0.5" clap = "^2.0" +http = "^0.2" hyper = { version = "0.14", features = ["full"] } tokio = { version = "^ 1.0", features = ["full"] } +tower-service = "^0.3.1" [dependencies.google-drive3] path = "../drive3" -version = "3.1.0+20220225" +version = "4.0.0+20220225" diff --git a/gen/drive3-cli/README.md b/gen/drive3-cli/README.md index 202e2ca24f..d888b6346a 100644 --- a/gen/drive3-cli/README.md +++ b/gen/drive3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *drive* API at revision *20220225*. The CLI is at version *3.1.0*. +This documentation was generated from the *drive* API at revision *20220225*. The CLI is at version *4.0.0*. ```bash drive3 [options] diff --git a/gen/drive3-cli/mkdocs.yml b/gen/drive3-cli/mkdocs.yml index 946babb27f..45104bd092 100644 --- a/gen/drive3-cli/mkdocs.yml +++ b/gen/drive3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: drive v3.1.0+20220225 +site_name: drive v4.0.0+20220225 site_url: http://byron.github.io/google-apis-rs/google-drive3-cli site_description: A complete library to interact with drive (protocol v3) diff --git a/gen/drive3-cli/src/main.rs b/gen/drive3-cli/src/main.rs index 6eba2817ad..0db759c46f 100644 --- a/gen/drive3-cli/src/main.rs +++ b/gen/drive3-cli/src/main.rs @@ -21,25 +21,36 @@ use client::{InvalidOptionsError, CLIError, arg_from_str, writer_from_opts, pars calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; use std::default::Default; +use std::error::Error as StdError; use std::str::FromStr; use serde_json as json; use clap::ArgMatches; +use http::Uri; +use hyper::client::connect; +use tokio::io::{AsyncRead, AsyncWrite}; +use tower_service; enum DoitError { IoError(String, io::Error), ApiError(Error), } -struct Engine<'n> { +struct Engine<'n, S> { opt: ArgMatches<'n>, - hub: api::DriveHub, + hub: api::DriveHub, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n> Engine<'n> { +impl<'n, S> Engine<'n, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ async fn _about_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.about().get(); @@ -4287,7 +4298,7 @@ impl<'n> Engine<'n> { } // Please note that this call will fail if any part of the opt can't be handled - async fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + async fn new(opt: ArgMatches<'n>, connector: S) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match client::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), @@ -4301,18 +4312,14 @@ impl<'n> Engine<'n> { } }; - let auth = oauth2::InstalledFlowAuthenticator::builder( + let client = hyper::Client::builder().build(connector); + + let auth = oauth2::InstalledFlowAuthenticator::with_client( secret, oauth2::InstalledFlowReturnMethod::HTTPRedirect, + client.clone(), ).persist_tokens_to_disk(format!("{}/drive3", config_dir)).build().await.unwrap(); - let client = hyper::Client::builder().build( - hyper_rustls::HttpsConnectorBuilder::new().with_native_roots() - .https_or_http() - .enable_http1() - .enable_http2() - .build() - ); let engine = Engine { opt: opt, hub: api::DriveHub::new(client, auth), @@ -5505,7 +5512,7 @@ async fn main() { let mut app = App::new("drive3") .author("Sebastian Thiel ") - .version("3.1.0+20220225") + .version("4.0.0+20220225") .about("Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_drive3_cli") .arg(Arg::with_name("url") @@ -5578,8 +5585,14 @@ async fn main() { let matches = app.get_matches(); - let debug = matches.is_present("debug"); - match Engine::new(matches).await { + let debug = matches.is_present("adebug"); + let connector = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots() + .https_or_http() + .enable_http1() + .enable_http2() + .build(); + + match Engine::new(matches, connector).await { Err(err) => { exit_status = err.exit_code; writeln!(io::stderr(), "{}", err).ok();